<?php

require_once '../../ConfigurationFactory.php';
require_once 'EntityChiave.php';

class Session extends Chiave {

    private $sessionCode;
    private $sessionStart;
    private $sessionEnd;
    private $from;

    public function __construct($id) {
        parent::__construct($id);
        $this->sessionStart = time();
        $conf = ConfigurationFactory::getInstance();
        $this->sessionEnd =  $this-> sessionStart + intval($conf->lifetime, 600);
    }

    public function getPropertyList() {
        $arrayEl = get_object_vars($this);
        $arrayEl['id'] = $this->getId();
        return $arrayEl;
    }

    public function getId() {
        return parent::getId();
    }

    public function setId($id) {
        parent::setId($id);
    }
    public function getSessionCode() {
        return $this->sessionCode;
    }

    public function setSessionCode($sessionCode) {
        $this->sessionCode = $sessionCode;
    }

    public function getSessionStart() {
        return $this->sessionStart;
    }

    public function setSessionStart($sessionStart) {
        $this->sessionStart = $sessionStart;
    }

    public function getSessionEnd() {
        return $this->sessionEnd;
    }

    public function setSessionEnd($sessionEnd) {
        $this->sessionEnd = $sessionEnd;
    }

    public function getFrom() {
        return $this->from;
    }

    public function setFrom($from) {
        $this->from = $from;
    }

}
?>
